﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace Matopeli
{
    public class Peli : INotifyPropertyChanged
    {
        #region Constructors
        
        public Peli()
        {
            omenat = new ObservableCollection<Omena>();
            matonen = new Matonen();
        }

        #endregion

        #region Properties

        ObservableCollection<Omena> omenat;
        public ObservableCollection<Omena> Omenat
        {
            get { return omenat; }
        }

        Matonen matonen;
        public Matonen Matonen
        {
            get { return matonen; }
            set
            {
                SetField(ref matonen, value, "Matonen");
            }
        }

        #endregion

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;

        public void SetField<T>(ref T field, T value, string propertyName)
        {
            if (EqualityComparer<T>.Default.Equals(field, value))
                return;

            field = value;

            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        
        #endregion
    }
}
